// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import vueAwesomeSwiper from 'vue-awesome-swiper'
import VueVideoPlayer from 'vue-video-player'
import 'video.js/dist/video-js.css'
import '../static/iconfont/iconfont.css'
import 'mint-ui/lib/style.css'
import '../static/flex.css'
import 'swiper/dist/css/swiper.css'
// eslint-disable-next-line standard/object-curly-even-spacing
import {Header, Button, Progress, Toast, Popup } from 'mint-ui'
// Vconsole
// import Vconsole from 'vconsole'
// const vConsole = new Vconsole()

Vue.component(Header.name, Header)
Vue.component(Button.name, Button)
Vue.component(Progress.name, Progress)
Vue.component(Toast.name, Toast)
Vue.component(Popup.name, Popup)
Vue.config.productionTip = false
Vue.use(vueAwesomeSwiper)
Vue.use(VueVideoPlayer /* {
  options: global default options,
  events: global videojs events
} */)
/* eslint-disable no-new */
const init = () => {
  new Vue({
    el: '#app',
    router,
    components: {App},
    template: '<App/>'
  })
}

// Wait for the deviceready event to start the render
document.addEventListener('deviceready', () => {
  // eslint-disable-next-line
  console.log("Ready, Render the App");
  init()
})

// If we are not in Cordova, manually trigger the deviceready event
const isCordovaApp = (typeof window.cordova !== 'undefined')
if (!isCordovaApp) {
  document.dispatchEvent(new CustomEvent('deviceready', {}))
}
